/* eslint-disable */

import { AxiosRequestConfig } from 'axios';
import { request } from '../../utils/request';

export interface PostCosUploadFileRes {
  code: string; // 返回编码
  msg: string; // 返回消息
  data: {
    md5: string; // image
    photoPath: string;
    photoUrl: string;
    photoSize: number;
    photoHeight: number;
    photoWidth: number;
    fileMd5: string; // media
    mediaPath: string;
    mediaUrl: string;
    fileName: string;
    fileType: string; // mp3, jpg, ...
    fileSize: number;
    checkQuality: string;
    duration: number;
    licensePath: string; // license
    licenseUrl: string;
    sourceFile: string; // EXCEL
    filePath: string;
  };
  traceId: string;
}

/**
 * 上传文件
 */
export async function postCosUploadFile(
  data?: any,
  config?: AxiosRequestConfig,
): Promise<PostCosUploadFileRes> {
  return request(data, {
    url: '/cos/uploadFile',
    method: 'post',
    ...config,
  });
}

export interface GetCosPreviewFileRes {
  code: string; // 返回编码
  msg: string; // 返回消息
  data: null; // 返回数据
  traceId: string;
}

/**
 * 预览
 */
export async function getCosPreviewFile(
  data?: any,
  config?: AxiosRequestConfig,
): Promise<GetCosPreviewFileRes> {
  return request(data, {
    url: '/cos/previewFile',
    method: 'get',
    ...config,
  });
}

export interface GetCosDownloadFileRes {
  code: string; // 返回编码
  msg: string; // 返回消息
  data: null; // 返回数据
  traceId: string;
}

/**
 * 下载
 */
export async function getCosDownloadFile(
  data?: any,
  config?: AxiosRequestConfig,
): Promise<GetCosDownloadFileRes> {
  return request(data, {
    url: '/cos/downloadFile',
    method: 'get',
    ...config,
  });
}
